#define _CRT_SECURE_NO_WARNINGS
#include "list.h"

struct A
{

	A(int a1 = 1, int a2 = 2)
		:_a1(a1)
		,_a2(a2)
	{ }
	A(const A& a)
		:_a1(a._a1)
		,_a2(a._a2)
	{ }

	int _a1;
	int _a2;
};
void test_list1()
{
	gy::list<int> lt;
	lt.push_back(1);
	lt.push_back(2);
	lt.push_back(3);
	lt.push_back(4);
	lt.push_back(5);
	lt.push_back(6);
	gy::list<int>::iterator it = lt.begin();
	while (it != lt.end())
	{
		cout << *it << " ";
		++it;
	}
	cout << endl;
}

void test_list2()
{
	gy::list<A> lt;
	lt.push_back({1,1});
	lt.push_back({2,2});
	lt.push_back({3,3});
	lt.push_back({4,4});
	lt.push_back({5,5});
	gy::list<A>::iterator it = lt.begin();
	while (it != lt.end())
	{
		//cout << (*it)._a1 << ":" << (*it)._a2 << " ";
		cout << it->_a1 << ":" << it->_a2 << " ";
		++it;
	}
	cout << endl;
}
void Print(gy::list<int>& lt)
{
	for (auto& e : lt)
	{
		cout << e << " ";
	}
	cout << endl;
}
void test_list3()
{
	gy::list<int> lt;
	lt.push_back(1);
	lt.push_back(2);
	lt.push_back(3);
	lt.push_back(4);
	Print(lt);

	lt.push_front(9);
	lt.push_front(7);
	lt.push_front(0);
	lt.push_front(6);
	Print(lt);

	lt.pop_back();
	Print(lt);

	lt.pop_front();
	Print(lt);
}
void test_list4()
{
	gy::list<int> lt1;
	lt1.push_back(2);
	lt1.push_back(3);
	lt1.push_back(4);
	gy::list<int> lt2;

	cout << lt1.size() << endl;
	cout << lt1.empty() << endl;

	cout << lt2.size() << endl;
	cout << lt2.empty() << endl;
}

void test_list5()
{
	gy::list<int> lt1;
	lt1.push_back(2);
	lt1.push_back(3);
	lt1.push_back(4);
	gy::list<int> lt2;
	Print(lt1);
	Print(lt2);
	lt2 = lt1;
	Print(lt2);
}
int main()
{
	test_list5();
	return 0;
}